<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            // 传参的时候扩展运算符的使用
            let arr = [1, 2];
            function getArr(arr, ...item) {
                arr.push(...item);
            }
            getArr(arr, 3, 4, 5);
            console.log(arr);

            // 进行数组，对象的合并
            let arr1 = [1, 2, 3];
            let arr2 = [4, 5];
            let arr3 = [6, 7];
            console.log([...arr1, ...arr2, ...arr3]);
            // 进行对象属性的合并，后面的对象属性和覆盖前面相同的对象属性
            let obj1 = { name: 'zs' };
            let obj2 = { name: 'lisi' };
            let obj3 = { age: 19 };
            console.log({ ...obj1, ...obj2, ...obj3 });
        </script>
    </body>
</html>
